package com.mc.moring.bean;

import android.content.Context;
import android.text.TextUtils;

import com.mc.moring.base.SaveZiLiPageTool;
import com.mc.moring.util.SharePreUtil;

import org.json.JSONObject;

/**
 * @ProjectName: ZhiLiProject
 * @Package: com.xx.text.bean
 * @ClassName: UserDataBean
 * @Author: ANWEN
 * @CreateDate: 2023/12/22 15:26
 * @UpdateUser:
 * @UpdateDate: 2023/12/22 15:26
 * @UpdateRemark:
 * @Version:
 */
public class ZiLiPageUserDataBean {

    private String headImg;
    private String userId;
    private String name;
    private String firstName;
    private String customerId;
    private boolean newUser;
    private String token;
    private String rewrite;
    private String lastName;
    private boolean rePassword;
    private String a;

    private String mobile;

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getMobile() {
        return mobile;
    }

    public static ZiLiPageUserDataBean instance;

    public static ZiLiPageUserDataBean getInstance() {
        if (instance == null){
            instance = new ZiLiPageUserDataBean();
        }
        return instance;
    }

    public static void setInstance(ZiLiPageUserDataBean instance) {
        ZiLiPageUserDataBean.instance = instance;
    }

    public void setData(JSONObject jsonObject, Context context){
        headImg = jsonObject.optString("headImg");
        userId = jsonObject.optString("userId");
        name = jsonObject.optString("name");
        mobile = jsonObject.optString("mobile");
        customerId = jsonObject.optString("customerId");
        newUser = jsonObject.optBoolean("newUser");
        token = jsonObject.optString("token");
        lastName = jsonObject.optString("lastName");
        rewrite = jsonObject.optString("rewrite");
        rePassword = jsonObject.optBoolean("rePassword");
        a = jsonObject.optString("a");
        SharePreUtil.saveStringData("user_info",jsonObject.toString());
        new SaveZiLiPageTool(context).puttKeyValue("user_info", jsonObject.toString());
    }

    public String getHeadImg() {
        return headImg;
    }

    public void setHeadImg(String headImg) {
        this.headImg = headImg;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public boolean isNewUser() {
        return newUser;
    }

    public void setNewUser(boolean newUser) {
        this.newUser = newUser;
    }

    public String getToken() {
        if(TextUtils.isEmpty(token)){
            token = "";
        }
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getRewrite() {
        return rewrite;
    }

    public void setRewrite(String rewrite) {
        this.rewrite = rewrite;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public boolean isRePassword() {
        return rePassword;
    }

    public void setRePassword(boolean rePassword) {
        this.rePassword = rePassword;
    }

    public String getA() {
        return a;
    }

    public void setA(String a) {
        this.a = a;
    }
}
